package com.canbot.u05.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;

import com.canbot.u05.R;
import com.canbot.u05.adapter.ChooseSpeechAdapter;
import com.canbot.u05.bean.Brow;
import com.canbot.u05.socket.MsgSendUtils;
import com.canbot.u05.socket.MsgType;
import com.canbot.u05.utils.PathConst;
import com.canbot.u05.utils.ToastTools;

import java.util.ArrayList;
import java.util.List;

/**
 * 语音选择表情
 */
public class ChooseActivity extends BaseActivityNoTitle implements AdapterView.OnItemClickListener {

        private ChooseSpeechAdapter chooseSpeechAdapter;

        List<Brow> mbrowList;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_choose);
                GridView mGridView = (GridView) findViewById(R.id.gv_content);
                chooseSpeechAdapter = new ChooseSpeechAdapter(ChooseActivity.this, getDate());
                mGridView.setOnItemClickListener(this);
                mGridView.setAdapter(chooseSpeechAdapter);
                chooseSpeechAdapter.notifyDataSetChanged();
        }

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                MsgSendUtils.sendStringMsg(MsgType.PLAY_SOUND, mbrowList.get(i).getPath());
                MsgSendUtils.sendStringMsg(MsgType.EYE_MOTION_TWO, mbrowList.get(i).getEyesID());
                MsgSendUtils.sendStringMsgToPad(MsgType.RECEIVER_MSG_SWITCH_ACTIVITY, mbrowList.get(i).getActionId()+"&&conn");
                ToastTools.newInstance(this).showText("" + mbrowList.get(i).getEyesID());

        }

        /**
         * 返回键
         */
        public void speechbackchoose(View view) {
                finish();
        }

        /**
         * 获取数据
         */
        private List<Brow> getDate() {
                mbrowList = new ArrayList<Brow>();

                Brow brow1 = new Brow(1, "伤心", "29", PathConst.EYE_MOTION_DIR + "U05_yjdh_1.wav", "1");
                Brow brow2 = new Brow(2, "傲慢", "33", PathConst.EYE_MOTION_DIR + "U05_yjdh_2.wav", "2");
                Brow brow3 = new Brow(3, "困", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_3.wav", "3");
                Brow brow4 = new Brow(4, "惊恐", "32", PathConst.EYE_MOTION_DIR + "U05_yjdh_4.wav", "5");
                Brow brow5 = new Brow(5, "惊讶", "32", PathConst.EYE_MOTION_DIR + "U05_yjdh_5.wav", "6");
                Brow brow6 = new Brow(6, "贪婪", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_6.wav", "7");
                Brow brow7 = new Brow(7, "委屈", "29", PathConst.EYE_MOTION_DIR + "U05_yjdh_7.wav", "8");
                Brow brow8 = new Brow(8, "愤怒", "28", PathConst.EYE_MOTION_DIR + "U05_yjdh_8.wav", "9");
                Brow brow9 = new Brow(9, "生气", "28", PathConst.EYE_MOTION_DIR + "U05_yjdh_9.wav", "10");
                Brow brow10 = new Brow(10, "爱心", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_10.wav", "12");
                Brow brow11 = new Brow(11, "头晕眼花", "33", PathConst.EYE_MOTION_DIR + "U05_yjdh_11.wav", "13");
                Brow brow12 = new Brow(12, "微笑", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_12.wav", "14");
                Brow brow13 = new Brow(13, "阴险", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_13.wav", "15");
                Brow brow14 = new Brow(14, "左看右看", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_14.wav", "17");
                Brow brow15 = new Brow(15, "眨眼", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_15.wav", "18");
                Brow brow16 = new Brow(16, "思念", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_16.wav", "26");
                Brow brow17 = new Brow(17, "疑惑", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_17.wav", "27");
                Brow brow18 = new Brow(18, "倒霉", "29", PathConst.EYE_MOTION_DIR + "U05_yjdh_18.wav", "28");
                Brow brow19 = new Brow(19, "抛媚眼", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_19.wav", "29");
                Brow brow20 = new Brow(20, "开心", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_20.wav", "30");
                Brow brow21 = new Brow(21, "惊喜", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_21.wav", "32");
                Brow brow22 = new Brow(22, "呆", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_22.wav", "33");
                Brow brow23 = new Brow(23, "害羞", "33", PathConst.EYE_MOTION_DIR + "U05_yjdh_23.wav", "34");
                Brow brow24 = new Brow(24, "晃动", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_24.wav", "35");
                Brow brow25 = new Brow(25, "鄙视", "33", PathConst.EYE_MOTION_DIR + "U05_yjdh_25.wav", "37");
                Brow brow26 = new Brow(26, "调皮", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_26.wav", "38");
                Brow brow27 = new Brow(27, "挑衅", "33", PathConst.EYE_MOTION_DIR + "U05_yjdh_27.wav", "39");
                Brow brow28 = new Brow(28, "尴尬", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_28.wav", "40");
                Brow brow29 = new Brow(29, "心碎", "31", PathConst.EYE_MOTION_DIR + "U05_yjdh_29.wav", "41");
                Brow brow30 = new Brow(30, "白眼", "30", PathConst.EYE_MOTION_DIR + "U05_yjdh_30.wav", "42");
                Brow brow31 = new Brow(31, "得意", "27", PathConst.EYE_MOTION_DIR + "U05_yjdh_31.wav", "43");
                Brow brow32 = new Brow(32, "嫌弃", "33", PathConst.EYE_MOTION_DIR + "U05_yjdh_32.wav", "44");


                mbrowList.add(brow1);
                mbrowList.add(brow2);
                mbrowList.add(brow3);
                mbrowList.add(brow4);
                mbrowList.add(brow5);
                mbrowList.add(brow6);
                mbrowList.add(brow7);
                mbrowList.add(brow8);
                mbrowList.add(brow9);
                mbrowList.add(brow10);
                mbrowList.add(brow11);
                mbrowList.add(brow12);
                mbrowList.add(brow13);
                mbrowList.add(brow14);
                mbrowList.add(brow15);
                mbrowList.add(brow16);
                mbrowList.add(brow17);
                mbrowList.add(brow18);
                mbrowList.add(brow19);
                mbrowList.add(brow20);
                mbrowList.add(brow21);
                mbrowList.add(brow22);
                mbrowList.add(brow23);
                mbrowList.add(brow24);
                mbrowList.add(brow25);
                mbrowList.add(brow26);
                mbrowList.add(brow27);
                mbrowList.add(brow28);
                mbrowList.add(brow29);
                mbrowList.add(brow30);
                mbrowList.add(brow31);
                mbrowList.add(brow32);
                return mbrowList;
        }
}
